<%--
  Created by IntelliJ IDEA.
  User: yuzi
  Date: 2018/4/18
  Time: 23:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="../script/jquery-1.4.4.js"></script>
<html>

<script type="text/javascript">
    $(function () {
        $(".delete").click(function () {
            var href = $(this).attr("href");
            $("form").attr("action", href).submit();
            return false;
        });
    })
</script>

<head>
    <title>员工信息</title>
    <form action="" method="post">
        <input type="hidden" name="_method" value="DELETE">
    </form>

    <c:if test="${empty requestScope.users}">
        没有员工信息
    </c:if>
    <c:if test="${!empty requestScope.users}">
        <table border="0" cellpadding="0">
            <tr>
                <th>ID</th>
                <th>姓名</th>
                <th>密码</th>
                <th>性别</th>
                <th>年龄</th>
                <th>省份</th>
                <th>城市</th>
                <th>街道</th>
                <th>邮箱</th>
                <th colspan="2">操作</th>
            </tr>
            <c:forEach items="${requestScope.users}" var="user">
            <tr>
                <td>${user.id}</td>
                <td>${user.userName}</td>
                <td>${user.passWord}</td>
                <td>
                    <c:if test="${user.gender == 1}">
                        男
                    </c:if>
                    <c:if test="${user.gender == 2}">
                        女
                    </c:if>
                </td>
                <td>${user.userAge}</td>
                <td>${user.aderess.province}</td>
                <td>${user.aderess.city}</td>
                <td>${user.aderess.street}</td>
                <td>${user.email}</td>
                <td><a href="/user/user/${user.id}">修改</a></td>
                <td><a class="delete" href="/user/user/${user.id}">删除</a></td>
            </tr>
            </c:forEach>
        </table>
    </c:if>

    <br>
    <br>
    <br>
    <br>
    <br>
    <a href="/user/user">添加用户</a>
</head>
<body>

</body>
</html>
